<%@page import="entities.Author"%>
<%@page import="models.AuthorModel"%>
<%@page import="systems.RecentlyAuthorUpdate"%>
<%@page import="entities.Category"%>
<%@page import="models.CategoryModel"%>
<%@page import="entities.Question"%>
<%@page import="models.QuestionModel"%>
<%@page import="systems.RecentlyUpdate"%>
<%@page import="java.util.List"%>
<%
//Get Lastest question
List<Question> lastestQuestion = RecentlyUpdate.getQuestions();

//Get categories
CategoryModel categoryModel = CategoryModel.getInstance();
List<Category> categories = categoryModel.getAll();

//Get recently author update
List<Author> authors = RecentlyAuthorUpdate.getAuthors();

%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

	<div class="rightMainContent">
				<div class="sidebar">
					<!-- ADV BEGIN -->
					<div class="adv">
						<script type="text/javascript"><!--
						google_ad_client = "ca-pub-2883566427648799";
						/* question_200x200 */
						google_ad_slot = "8260099882";
						google_ad_width = 200;
						google_ad_height = 200;
						//-->
						</script>
						<script type="text/javascript"
						src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
						</script>
					</div>
					<!-- ADV END -->
					
					<!-- Category -->
					<div class="categoriesArea">
						<h3 class="titleSidebar">Categories</h3>
						<ul class="list_item">
							<% for (Category category : categories) { %>
							<li><a href="/c/<%=category.getAlias()%>-<%=category.getId()%>"><%=category.getName() %></a></li>
							<% } %>
						</ul>
					</div>
					<!-- End Category -->
					
					<!-- Latest Question -->
					<div class="lastestQuestionArea">
						<h3 class="titleSidebar">Lastest Question</h3>
						<ul class="list_item">
							<% 
							for (int i = 0 ; i < lastestQuestion.size(); i++) { 
								if (i >= 5) break;
							%>
							<li><a href="/q/<%=lastestQuestion.get(i).getId()%>"><%=lastestQuestion.get(i).getTitle() %></a></li>
							<% } %>
						</ul>
					</div>
					<!-- End lastest Question -->
					
					<!-- Top User -->
					<div class="topUserArea">
						<h3 class="titleSidebar clearafter">
							Lastest users
						</h3>
						
						<ul class="user-items">
							<% 
							for (int i = 0; i < authors.size(); i++) { 
								if (i >= 5) break;
							%>
							<li class="clearafter">
								<a href="/a/<%=authors.get(i).getAlias()%>-<%=authors.get(i).getId()%>"><img height="26" width="26" src="<%=authors.get(i).getAvatar()%>" class="avatar"></a>
								<span class="user">
									<a href="/a/<%=authors.get(i).getAlias()%>-<%=authors.get(i).getId()%>"><%=authors.get(i).getName() %></a>
								</span>
							</li>
							<% } %>
						</ul>
					</div>
					<!-- End Top User -->
					
					<!-- Other Info -->
					<div class="infoArea">
						<h3 class="titleSidebar">Need More Help?</h3>
						<p>If you have any questions, or comments and suggestions, please use the form below to contact us. Or you can mail to contact to us.</p>
					</div>
					<!-- Other Info -->
				</div>
			</div>